<template>
  <div>
    <div style="padding: 5px 10px">
      <el-row>
        <el-col :span="12">
        </el-col>
        <el-col :span="12">
          <h2 style="float: right;margin-bottom: 0px">规划编码:{{detaildata.pmuc}}</h2>
        </el-col>
      </el-row>
      <table class="bs-table">
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">文号</th>
          <td class="bs-table_td" colspan="3">
            <span style="vertical-align: bottom" v-if="detaildata.releaseNo">【{{detaildata.releaseNo}}】</span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划名称</th>
          <td class="bs-table_td" colspan="3">
            <el-link style="font-weight: bold;font-size: 20px" href="javascript:;" target="_blank">{{detaildata.title}}</el-link>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">{{detaildata.state=='0'?'(拟申报)规划类型':'规划类型'}}</th>
          <td class="bs-table_td">{{BASICINFO.category[detaildata.category]}}</td>
          <th class="bs-table_th" style="width: 200px">规划期限</th>
          <td class="bs-table_td">{{detaildata.startDate}}至{{detaildata.endDate}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">申报(牵头)单位</th>
          <td class="bs-table_td">{{detaildata.orgName}}</td>
          <th class="bs-table_th">规划等级</th>
          <td class="bs-table_td">{{BASICINFO.planningRank[detaildata.planningRank]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">{{detaildata.state=='0'?'(拟)发布时间':'发布时间'}}</th>
          <td class="bs-table_td">{{detaildata.releaseDate}}</td>
          <th class="bs-table_th">{{detaildata.state=='0'?'(拟)发布层级':'发布层级'}}</th>
          <td class="bs-table_td">{{BASICINFO.planningLevel[detaildata.planningLevel]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">审批机关级别</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityLevel[detaildata.approvingAuthorityLevel]}}</td>
          <th class="bs-table_th">审批机关性质</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityNature[detaildata.approvingAuthorityNature]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">联系人姓名</th>
          <td class="bs-table_td">{{detaildata.contactName}}</td>
          <th class="bs-table_th">联系电话</th>
          <td class="bs-table_td">{{detaildata.contactNumber}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">编制经费来源</th>
          <td class="bs-table_td" colspan="3">
            {{detaildata.financialSource}}
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">立项依据</th>
          <td class="bs-table_td" colspan="3">
            <span v-html="detaildata.basis"></span>
            <span v-if="detaildata.basisFileId">
              <!--<span style="font-weight: bold;font-size: 14px">依据材料:</span><el-link :href="'/planning/file/download/'+detaildata.basisFileId" type="danger" v-if="detaildata.fileId">下载</el-link>-->
              <preview :attachementId="detaildata.basisFileId" v-if="detaildata.basisFileId"></preview>
            </span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">主要内容</th>
          <td class="bs-table_td" colspan="3" v-html="detaildata.content">
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">规划文本</th>
          <td class="bs-table_td" colspan="3">
            <!--<el-link :href="'/planning/file/download/'+detaildata.textId" type="danger" v-if="detaildata.textId">下载</el-link>-->
            <preview :attachementId="detaildata.textId" v-if="detaildata.textId"></preview>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">相关材料</th>
          <td class="bs-table_td" colspan="3">
            <!--<el-link :href="'/planning/file/download/'+detaildata.fileId" type="danger" v-if="detaildata.fileId">下载</el-link>-->
            <div :key="fileid" v-for="fileid in detaildata.relatedFiles">
              <preview :attachementId="Number(fileid)" v-if="fileid"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">是否公开</th>
          <td class="bs-table_td">{{BASICINFO.isOpen[detaildata.isOpen]}}</td>
          <th class="bs-table_th"></th>
          <td class="bs-table_td"></td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
  import {reviewRegDetail} from "@/api/review";
  import {resultDetail} from "@/api/planning/result";
  import {BASICINFO} from "@/const/planning";
  
  export default {
    name: "planDetail",
    props: {
      id: Number
    },
    created() {
      this.reviewRegDetailData();
    },
    computed: {},
    data() {
      return {
        detaildata: {
          relatedFiles:[],
        },
        BASICINFO:BASICINFO

      }
    },
    methods: {
      reviewRegDetailData() {
        reviewRegDetail(this.id).then(response => {
          resultDetail(response.data.data.achievementId).then(response => {
            this.detaildata=response.data.data
            if(this.detaildata.fileId!=''&&this.detaildata.fileId!=null){
              this.detaildata.relatedFiles = this.detaildata.fileId.split(',')
            }
          })
        });
      },
  }
  }
</script>

<style ang="scss" scoped>

</style>
